home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / PC Card Manager / CIncludes / Memory.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-13  |  18.6 KB  |  807 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Memory.h
  3.  
  4.      Contains:    Memory Manager Interfaces.
  5.  
  6.      Version:    System 7.5
  7.  
  8.      DRI:        Barton House
  9.  
  10.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Warning:    *** APPLE INTERNAL USE ONLY ***
  14.                  This file may contain unreleased API's
  15.  
  16.      BuildInfo:    Built by:            SuperMario Build Daemon
  17.                  With Interfacer:    2.0d11   (PowerPC native)
  18.                  From:                Memory.i
  19.                      Revision:        43
  20.                      Dated:            5/29/96
  21.                      Last change by:    JL
  22.                      Last comment:    Added LockMemoryForOutput.
  23.  
  24.      Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. /*
  29.  NOTE
  30.  
  31.  Don’t change GetHandleSize and GetPtrSize into inlines.  They are documented as returning
  32.  0 in case of an error in Inside Mac, but the traps actually return an error code in D0.
  33.  The glue sets D0 to 0 if an error occured.
  34. */
  35. #ifndef __MEMORY__
  36. #define __MEMORY__
  37.  
  38. #ifndef __TYPES__
  39. #include <Types.h>
  40. #endif
  41. #ifndef __MIXEDMODE__
  42. #include <MixedMode.h>
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT_SUPPORTED
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_ALIGN_SUPPORTED
  54. #pragma options align=mac68k
  55. #endif
  56.  
  57.  
  58. enum {
  59.     maxSize                        = 0x00800000,                    /*Max data block size is 8 megabytes*/
  60.     defaultPhysicalEntryCount    = 8,                            /* values returned from the GetPageState function */
  61.     kPageInMemory                = 0,
  62.     kPageOnDisk                    = 1,
  63.     kNotPaged                    = 2
  64. };
  65.  
  66.  
  67. enum {
  68.                                                                 /* masks for Zone->heapType field */
  69.     k32BitHeap                    = 1,                            /* valid in all Memory Managers */
  70.     kNewStyleHeap                = 2,                            /* true if new Heap Manager is present */
  71.     kNewDebugHeap                = 4                                /* true if new Heap Manager is running in debug mode on this heap */
  72. };
  73.  
  74. /* size of a block in bytes */
  75. typedef long Size;
  76. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  77. typedef pascal long (*GrowZoneProcPtr)(Size cbNeeded);
  78. typedef pascal void (*PurgeProcPtr)(Handle blockToPurge);
  79. /*
  80.         This ProcPtr uses register based parameters on the 68k and cannot
  81.         be written in or called from a high-level language without the help of
  82.         mixed mode or assembly glue.
  83.  
  84.             typedef pascal void (*UserFnProcPtr)(void *parameter);
  85.  
  86. */
  87.  
  88. #if GENERATINGCFM
  89. typedef UniversalProcPtr GrowZoneUPP;
  90. typedef UniversalProcPtr PurgeUPP;
  91. typedef UniversalProcPtr UserFnUPP;
  92. #else
  93. typedef GrowZoneProcPtr GrowZoneUPP;
  94. typedef PurgeProcPtr PurgeUPP;
  95. typedef Register68kProcPtr UserFnUPP;
  96. #endif
  97. struct Zone {
  98.     Ptr                             bkLim;
  99.     Ptr                             purgePtr;
  100.     Ptr                             hFstFree;
  101.     long                             zcbFree;
  102.     GrowZoneUPP                     gzProc;
  103.     short                             moreMast;
  104.     short                             flags;
  105.     short                             cntRel;
  106.     short                             maxRel;
  107.     short                             cntNRel;
  108.     SInt8                             heapType;                    /* previously "maxNRel", now holds flags (e.g. k32BitHeap)*/
  109.     SInt8                             unused;
  110.     short                             cntEmpty;
  111.     short                             cntHandles;
  112.     long                             minCBFree;
  113.     PurgeUPP                         purgeProc;
  114.     Ptr                             sparePtr;
  115.     Ptr                             allocPtr;
  116.     short                             heapData;
  117. };
  118. typedef struct Zone Zone;
  119.  
  120. typedef Zone *THz;
  121. struct MemoryBlock {
  122.     void *                            address;
  123.     unsigned long                     count;
  124. };
  125. typedef struct MemoryBlock MemoryBlock;
  126.  
  127. struct LogicalToPhysicalTable {
  128.     MemoryBlock                     logical;
  129.     MemoryBlock                     physical[8];
  130. };
  131. typedef struct LogicalToPhysicalTable LogicalToPhysicalTable;
  132.  
  133. typedef short PageState;
  134. typedef short StatusRegisterContents;
  135.  
  136. enum {
  137.     uppGrowZoneProcInfo = kPascalStackBased
  138.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  139.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Size))),
  140.     uppPurgeProcInfo = kPascalStackBased
  141.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))),
  142.     uppUserFnProcInfo = kRegisterBased
  143.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(void *)))
  144. };
  145.  
  146. #if GENERATINGCFM
  147. #define NewGrowZoneProc(userRoutine)        \
  148.         (GrowZoneUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppGrowZoneProcInfo, GetCurrentArchitecture())
  149. #define NewPurgeProc(userRoutine)        \
  150.         (PurgeUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPurgeProcInfo, GetCurrentArchitecture())
  151. #define NewUserFnProc(userRoutine)        \
  152.         (UserFnUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserFnProcInfo, GetCurrentArchitecture())
  153. #else
  154. #define NewGrowZoneProc(userRoutine)        \
  155.         ((GrowZoneUPP) (userRoutine))
  156. #define NewPurgeProc(userRoutine)        \
  157.         ((PurgeUPP) (userRoutine))
  158. #define NewUserFnProc(userRoutine)        \
  159.         ((UserFnUPP) (userRoutine))
  160. #endif
  161.  
  162. #if GENERATINGCFM
  163. #define CallGrowZoneProc(userRoutine, cbNeeded)        \
  164.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppGrowZoneProcInfo, (cbNeeded))
  165. #define CallPurgeProc(userRoutine, blockToPurge)        \
  166.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPurgeProcInfo, (blockToPurge))
  167. #define CallUserFnProc(userRoutine, parameter)        \
  168.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppUserFnProcInfo, (parameter))
  169. #else
  170. #define CallGrowZoneProc(userRoutine, cbNeeded)        \
  171.         (*(userRoutine))((cbNeeded))
  172. #define CallPurgeProc(userRoutine, blockToPurge)        \
  173.         (*(userRoutine))((blockToPurge))
  174. /* (*UserFnUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  175. #endif
  176. extern pascal Ptr GetApplLimit(void)
  177.  TWOWORDINLINE(0x2EB8, 0x0130);
  178.  
  179. extern pascal THz SystemZone(void)
  180.  TWOWORDINLINE(0x2EB8, 0x02A6);
  181.  
  182. extern pascal THz ApplicationZone(void)
  183.  TWOWORDINLINE(0x2EB8, 0x02AA);
  184.  
  185. extern pascal Handle GZSaveHnd(void)
  186.  TWOWORDINLINE(0x2EB8, 0x0328);
  187.  
  188. extern pascal Ptr TopMem(void)
  189.  TWOWORDINLINE(0x2EB8, 0x0108);
  190.  
  191. extern pascal OSErr MemError(void)
  192.  TWOWORDINLINE(0x3EB8, 0x0220);
  193.  
  194. #endif
  195. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  196.  
  197. #if !GENERATINGCFM
  198. #pragma parameter __A0 GetZone
  199. #endif
  200. extern pascal THz GetZone(void )
  201.  ONEWORDINLINE(0xA11A);
  202.  
  203.  
  204. #if !GENERATINGCFM
  205. #pragma parameter __A0 NewHandle(__D0)
  206. #endif
  207. extern pascal Handle NewHandle(Size byteCount)
  208.  ONEWORDINLINE(0xA122);
  209.  
  210.  
  211. #if !GENERATINGCFM
  212. #pragma parameter __A0 NewHandleSys(__D0)
  213. #endif
  214. extern pascal Handle NewHandleSys(Size byteCount)
  215.  ONEWORDINLINE(0xA522);
  216.  
  217.  
  218. #if !GENERATINGCFM
  219. #pragma parameter __A0 NewHandleClear(__D0)
  220. #endif
  221. extern pascal Handle NewHandleClear(Size byteCount)
  222.  ONEWORDINLINE(0xA322);
  223.  
  224.  
  225. #if !GENERATINGCFM
  226. #pragma parameter __A0 NewHandleSysClear(__D0)
  227. #endif
  228. extern pascal Handle NewHandleSysClear(Size byteCount)
  229.  ONEWORDINLINE(0xA722);
  230.  
  231.  
  232. #if !GENERATINGCFM
  233. #pragma parameter __A0 HandleZone(__A0)
  234. #endif
  235. extern pascal THz HandleZone(Handle h)
  236.  ONEWORDINLINE(0xA126);
  237.  
  238.  
  239. #if !GENERATINGCFM
  240. #pragma parameter __A0 RecoverHandle(__A0)
  241. #endif
  242. extern pascal Handle RecoverHandle(Ptr p)
  243.  ONEWORDINLINE(0xA128);
  244.  
  245.  
  246. #if !GENERATINGCFM
  247. #pragma parameter __A0 RecoverHandleSys(__A0)
  248. #endif
  249. extern pascal Handle RecoverHandleSys(Ptr p)
  250.  ONEWORDINLINE(0xA528);
  251.  
  252.  
  253. #if !GENERATINGCFM
  254. #pragma parameter __A0 NewPtr(__D0)
  255. #endif
  256. extern pascal Ptr NewPtr(Size byteCount)
  257.  ONEWORDINLINE(0xA11E);
  258.  
  259.  
  260. #if !GENERATINGCFM
  261. #pragma parameter __A0 NewPtrSys(__D0)
  262. #endif
  263. extern pascal Ptr NewPtrSys(Size byteCount)
  264.  ONEWORDINLINE(0xA51E);
  265.  
  266.  
  267. #if !GENERATINGCFM
  268. #pragma parameter __A0 NewPtrClear(__D0)
  269. #endif
  270. extern pascal Ptr NewPtrClear(Size byteCount)
  271.  ONEWORDINLINE(0xA31E);
  272.  
  273.  
  274. #if !GENERATINGCFM
  275. #pragma parameter __A0 NewPtrSysClear(__D0)
  276. #endif
  277. extern pascal Ptr NewPtrSysClear(Size byteCount)
  278.  ONEWORDINLINE(0xA71E);
  279.  
  280.  
  281. #if !GENERATINGCFM
  282. #pragma parameter __A0 PtrZone(__A0)
  283. #endif
  284. extern pascal THz PtrZone(Ptr p)
  285.  ONEWORDINLINE(0xA148);
  286.  
  287.  
  288. #if !GENERATINGCFM
  289. #pragma parameter __D0 MaxBlock
  290. #endif
  291. extern pascal long MaxBlock(void )
  292.  ONEWORDINLINE(0xA061);
  293.  
  294.  
  295. #if !GENERATINGCFM
  296. #pragma parameter __D0 MaxBlockSys
  297. #endif
  298. extern pascal long MaxBlockSys(void )
  299.  ONEWORDINLINE(0xA461);
  300.  
  301.  
  302. #if !GENERATINGCFM
  303. #pragma parameter __D0 StackSpace
  304. #endif
  305. extern pascal long StackSpace(void )
  306.  ONEWORDINLINE(0xA065);
  307.  
  308.  
  309. #if !GENERATINGCFM
  310. #pragma parameter __A0 NewEmptyHandle
  311. #endif
  312. extern pascal Handle NewEmptyHandle(void )
  313.  ONEWORDINLINE(0xA166);
  314.  
  315.  
  316. #if !GENERATINGCFM
  317. #pragma parameter __A0 NewEmptyHandleSys
  318. #endif
  319. extern pascal Handle NewEmptyHandleSys(void )
  320.  ONEWORDINLINE(0xA566);
  321.  
  322.  
  323. #if !GENERATINGCFM
  324. #pragma parameter HLock(__A0)
  325. #endif
  326. extern pascal void HLock(Handle h)
  327.  ONEWORDINLINE(0xA029);
  328.  
  329.  
  330. #if !GENERATINGCFM
  331. #pragma parameter HUnlock(__A0)
  332. #endif
  333. extern pascal void HUnlock(Handle h)
  334.  ONEWORDINLINE(0xA02A);
  335.  
  336.  
  337. #if !GENERATINGCFM
  338. #pragma parameter HPurge(__A0)
  339. #endif
  340. extern pascal void HPurge(Handle h)
  341.  ONEWORDINLINE(0xA049);
  342.  
  343.  
  344. #if !GENERATINGCFM
  345. #pragma parameter HNoPurge(__A0)
  346. #endif
  347. extern pascal void HNoPurge(Handle h)
  348.  ONEWORDINLINE(0xA04A);
  349.  
  350.  
  351. #if !GENERATINGCFM
  352. #pragma parameter HLockHi(__A0)
  353. #endif
  354. extern pascal void HLockHi(Handle h)
  355.  TWOWORDINLINE(0xA064, 0xA029);
  356.  
  357. extern pascal Handle TempNewHandle(Size logicalSize, OSErr *resultCode)
  358.  THREEWORDINLINE(0x3F3C, 0x001D, 0xA88F);
  359.  
  360. extern pascal Size TempMaxMem(Size *grow)
  361.  THREEWORDINLINE(0x3F3C, 0x0015, 0xA88F);
  362.  
  363. extern pascal long TempFreeMem(void )
  364.  THREEWORDINLINE(0x3F3C, 0x0018, 0xA88F);
  365.  
  366. extern pascal void InitZone(GrowZoneUPP pgrowZone, short cmoreMasters, void *limitPtr, void *startPtr);
  367.  
  368.  
  369. #if !GENERATINGCFM
  370. #pragma parameter SetZone(__A0)
  371. #endif
  372. extern pascal void SetZone(THz hz)
  373.  ONEWORDINLINE(0xA01B);
  374.  
  375.  
  376. #if !GENERATINGCFM
  377. #pragma parameter __D0 CompactMem(__D0)
  378. #endif
  379. extern pascal Size CompactMem(Size cbNeeded)
  380.  ONEWORDINLINE(0xA04C);
  381.  
  382.  
  383. #if !GENERATINGCFM
  384. #pragma parameter __D0 CompactMemSys(__D0)
  385. #endif
  386. extern pascal Size CompactMemSys(Size cbNeeded)
  387.  ONEWORDINLINE(0xA44C);
  388.  
  389.  
  390. #if !GENERATINGCFM
  391. #pragma parameter PurgeMem(__D0)
  392. #endif
  393. extern pascal void PurgeMem(Size cbNeeded)
  394.  ONEWORDINLINE(0xA04D);
  395.  
  396.  
  397. #if !GENERATINGCFM
  398. #pragma parameter PurgeMemSys(__D0)
  399. #endif
  400. extern pascal void PurgeMemSys(Size cbNeeded)
  401.  ONEWORDINLINE(0xA44D);
  402.  
  403.  
  404. #if !GENERATINGCFM
  405. #pragma parameter __D0 FreeMem
  406. #endif
  407. extern pascal long FreeMem(void )
  408.  ONEWORDINLINE(0xA01C);
  409.  
  410.  
  411. #if !GENERATINGCFM
  412. #pragma parameter __D0 FreeMemSys
  413. #endif
  414. extern pascal long FreeMemSys(void )
  415.  ONEWORDINLINE(0xA41C);
  416.  
  417.  
  418. #if !GENERATINGCFM
  419. #pragma parameter ReserveMem(__D0)
  420. #endif
  421. extern pascal void ReserveMem(Size cbNeeded)
  422.  ONEWORDINLINE(0xA040);
  423.  
  424.  
  425. #if !GENERATINGCFM
  426. #pragma parameter ReserveMemSys(__D0)
  427. #endif
  428. extern pascal void ReserveMemSys(Size cbNeeded)
  429.  ONEWORDINLINE(0xA440);
  430.  
  431.  
  432. #if !GENERATINGCFM
  433. #pragma parameter __D0 MaxMem(__A1)
  434. #endif
  435. extern pascal Size MaxMem(Size *grow)
  436.  TWOWORDINLINE(0xA11D, 0x2288);
  437.  
  438.  
  439. #if !GENERATINGCFM
  440. #pragma parameter __D0 MaxMemSys(__A1)
  441. #endif
  442. extern pascal Size MaxMemSys(Size *grow)
  443.  TWOWORDINLINE(0xA51D, 0x2288);
  444.  
  445.  
  446. #if !GENERATINGCFM
  447. #pragma parameter SetGrowZone(__A0)
  448. #endif
  449. extern pascal void SetGrowZone(GrowZoneUPP growZone)
  450.  ONEWORDINLINE(0xA04B);
  451.  
  452.  
  453. #if !GENERATINGCFM
  454. #pragma parameter MoveHHi(__A0)
  455. #endif
  456. extern pascal void MoveHHi(Handle h)
  457.  ONEWORDINLINE(0xA064);
  458.  
  459.  
  460. #if !GENERATINGCFM
  461. #pragma parameter DisposePtr(__A0)
  462. #endif
  463. extern pascal void DisposePtr(Ptr p)
  464.  ONEWORDINLINE(0xA01F);
  465.  
  466. extern pascal Size GetPtrSize(Ptr p);
  467.  
  468.  
  469. #if !GENERATINGCFM
  470. #pragma parameter SetPtrSize(__A0, __D0)
  471. #endif
  472. extern pascal void SetPtrSize(Ptr p, Size newSize)
  473.  ONEWORDINLINE(0xA020);
  474.  
  475.  
  476. #if !GENERATINGCFM
  477. #pragma parameter DisposeHandle(__A0)
  478. #endif
  479. extern pascal void DisposeHandle(Handle h)
  480.  ONEWORDINLINE(0xA023);
  481.  
  482.  
  483. #if !GENERATINGCFM
  484. #pragma parameter SetHandleSize(__A0, __D0)
  485. #endif
  486. extern pascal void SetHandleSize(Handle h, Size newSize)
  487.  ONEWORDINLINE(0xA024);
  488.  
  489. extern pascal Size GetHandleSize(Handle h);
  490.  
  491.  
  492. #if !GENERATINGCFM
  493. #pragma parameter __D0 InlineGetHandleSize(__A0)
  494. #endif
  495. extern pascal Size InlineGetHandleSize(Handle h)
  496.  ONEWORDINLINE(0xA025);
  497.  
  498.  
  499. #if !GENERATINGCFM
  500. #pragma parameter ReallocateHandle(__A0, __D0)
  501. #endif
  502. extern pascal void ReallocateHandle(Handle h, Size byteCount)
  503.  ONEWORDINLINE(0xA027);
  504.  
  505.  
  506. #if !GENERATINGCFM
  507. #pragma parameter ReallocateHandleSys(__A0, __D0)
  508. #endif
  509. extern pascal void ReallocateHandleSys(Handle h, Size byteCount)
  510.  ONEWORDINLINE(0xA427);
  511.  
  512.  
  513. #if !GENERATINGCFM
  514. #pragma parameter EmptyHandle(__A0)
  515. #endif
  516. extern pascal void EmptyHandle(Handle h)
  517.  ONEWORDINLINE(0xA02B);
  518.  
  519.  
  520. #if !GENERATINGCFM
  521. #pragma parameter HSetRBit(__A0)
  522. #endif
  523. extern pascal void HSetRBit(Handle h)
  524.  ONEWORDINLINE(0xA067);
  525.  
  526.  
  527. #if !GENERATINGCFM
  528. #pragma parameter HClrRBit(__A0)
  529. #endif
  530. extern pascal void HClrRBit(Handle h)
  531.  ONEWORDINLINE(0xA068);
  532.  
  533.  
  534. #if !GENERATINGCFM
  535. #pragma parameter __D0 HGetState(__A0)
  536. #endif
  537. extern pascal SInt8 HGetState(Handle h)
  538.  ONEWORDINLINE(0xA069);
  539.  
  540.  
  541. #if !GENERATINGCFM
  542. #pragma parameter HSetState(__A0, __D0)
  543. #endif
  544. extern pascal void HSetState(Handle h, SInt8 flags)
  545.  ONEWORDINLINE(0xA06A);
  546.  
  547. extern pascal void PurgeSpace(long *total, long *contig);
  548.  
  549. #endif
  550. #if FOR_SYSTEM7_ONLY
  551. /* These are defined in Kernel for System 8 */
  552.  
  553. #if !GENERATINGCFM
  554. #pragma parameter BlockMove(__A0, __A1, __D0)
  555. #endif
  556. extern pascal void BlockMove(const void *srcPtr, void *destPtr, Size byteCount)
  557.  ONEWORDINLINE(0xA02E);
  558.  
  559.  
  560. #if !GENERATINGCFM
  561. #pragma parameter BlockMoveData(__A0, __A1, __D0)
  562. #endif
  563. extern pascal void BlockMoveData(const void *srcPtr, void *destPtr, Size byteCount)
  564.  ONEWORDINLINE(0xA22E);
  565.  
  566. extern void BlockMoveUncached(const void *srcPtr, void *destPtr, Size byteCount);
  567.  
  568. extern void BlockMoveDataUncached(const void *srcPtr, void *destPtr, Size byteCount);
  569.  
  570. extern void BlockZero(void *destPtr, Size byteCount);
  571.  
  572. extern void BlockZeroUncached(void *destPtr, Size byteCount);
  573.  
  574. #endif
  575. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  576. extern pascal void MaxApplZone(void )
  577.  ONEWORDINLINE(0xA063);
  578.  
  579.  
  580. #if !GENERATINGCFM
  581. #pragma parameter SetApplBase(__A0)
  582. #endif
  583. extern pascal void SetApplBase(void *startPtr)
  584.  ONEWORDINLINE(0xA057);
  585.  
  586. extern pascal void MoreMasters(void )
  587.  ONEWORDINLINE(0xA036);
  588.  
  589.  
  590. #if !GENERATINGCFM
  591. #pragma parameter SetApplLimit(__A0)
  592. #endif
  593. extern pascal void SetApplLimit(void *zoneLimit)
  594.  ONEWORDINLINE(0xA02D);
  595.  
  596. #endif
  597. #if FOR_SYSTEM7_ONLY
  598. extern pascal void InitApplZone(void )
  599.  ONEWORDINLINE(0xA02C);
  600.  
  601. #endif
  602. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  603. /*  Temporary Memory routines renamed, but obsolete, in System 7.0 and later.  */
  604. extern pascal void TempHLock(Handle h, OSErr *resultCode)
  605.  THREEWORDINLINE(0x3F3C, 0x001E, 0xA88F);
  606.  
  607. extern pascal void TempHUnlock(Handle h, OSErr *resultCode)
  608.  THREEWORDINLINE(0x3F3C, 0x001F, 0xA88F);
  609.  
  610. extern pascal void TempDisposeHandle(Handle h, OSErr *resultCode)
  611.  THREEWORDINLINE(0x3F3C, 0x0020, 0xA88F);
  612.  
  613. extern pascal Ptr TempTopMem(void )
  614.  THREEWORDINLINE(0x3F3C, 0x0016, 0xA88F);
  615.  
  616. #endif
  617. #if FOR_SYSTEM7_ONLY
  618.  
  619. #if !GENERATINGCFM
  620. #pragma parameter __D0 HoldMemory(__A0, __A1)
  621. #endif
  622. extern pascal OSErr HoldMemory(void *address, unsigned long count)
  623.  TWOWORDINLINE(0x7000, 0xA05C);
  624.  
  625.  
  626. #if !GENERATINGCFM
  627. #pragma parameter __D0 UnholdMemory(__A0, __A1)
  628. #endif
  629. extern pascal OSErr UnholdMemory(void *address, unsigned long count)
  630.  TWOWORDINLINE(0x7001, 0xA05C);
  631.  
  632.  
  633. #if !GENERATINGCFM
  634. #pragma parameter __D0 LockMemory(__A0, __A1)
  635. #endif
  636. extern pascal OSErr LockMemory(void *address, unsigned long count)
  637.  TWOWORDINLINE(0x7002, 0xA05C);
  638.  
  639.  
  640. #if !GENERATINGCFM
  641. #pragma parameter __D0 LockMemoryForOutput(__A0, __A1)
  642. #endif
  643. extern pascal OSErr LockMemoryForOutput(void *address, unsigned long count)
  644.  TWOWORDINLINE(0x700A, 0xA05C);
  645.  
  646.  
  647. #if !GENERATINGCFM
  648. #pragma parameter __D0 LockMemoryContiguous(__A0, __A1)
  649. #endif
  650. extern pascal OSErr LockMemoryContiguous(void *address, unsigned long count)
  651.  TWOWORDINLINE(0x7004, 0xA05C);
  652.  
  653.  
  654. #if !GENERATINGCFM
  655. #pragma parameter __D0 UnlockMemory(__A0, __A1)
  656. #endif
  657. extern pascal OSErr UnlockMemory(void *address, unsigned long count)
  658.  TWOWORDINLINE(0x7003, 0xA05C);
  659.  
  660. extern pascal OSErr GetPhysical(LogicalToPhysicalTable *addresses, unsigned long *physicalEntryCount);
  661.  
  662.  
  663. #if !GENERATINGCFM
  664. #pragma parameter __D0 DeferUserFn(__A0, __D0)
  665. #endif
  666. extern pascal OSErr DeferUserFn(UserFnUPP userFunction, void *argument)
  667.  ONEWORDINLINE(0xA08F);
  668.  
  669.  
  670. #if !GENERATINGCFM
  671. #pragma parameter __D0 DebuggerGetMax
  672. #endif
  673. extern pascal long DebuggerGetMax(void )
  674.  TWOWORDINLINE(0x7000, 0xA08D);
  675.  
  676. extern pascal void DebuggerEnter(void )
  677.  TWOWORDINLINE(0x7001, 0xA08D);
  678.  
  679. extern pascal void DebuggerExit(void )
  680.  TWOWORDINLINE(0x7002, 0xA08D);
  681.  
  682. extern pascal void DebuggerPoll(void )
  683.  TWOWORDINLINE(0x7003, 0xA08D);
  684.  
  685.  
  686. #if !GENERATINGCFM
  687. #pragma parameter __D0 GetPageState(__A0)
  688. #endif
  689. extern pascal PageState GetPageState(const void *address)
  690.  TWOWORDINLINE(0x7004, 0xA08D);
  691.  
  692.  
  693. #if !GENERATINGCFM
  694. #pragma parameter __D0 PageFaultFatal
  695. #endif
  696. extern pascal Boolean PageFaultFatal(void )
  697.  TWOWORDINLINE(0x7005, 0xA08D);
  698.  
  699.  
  700. #if !GENERATINGCFM
  701. #pragma parameter __D0 DebuggerLockMemory(__A0, __A1)
  702. #endif
  703. extern pascal OSErr DebuggerLockMemory(void *address, unsigned long count)
  704.  TWOWORDINLINE(0x7006, 0xA08D);
  705.  
  706.  
  707. #if !GENERATINGCFM
  708. #pragma parameter __D0 DebuggerUnlockMemory(__A0, __A1)
  709. #endif
  710. extern pascal OSErr DebuggerUnlockMemory(void *address, unsigned long count)
  711.  TWOWORDINLINE(0x7007, 0xA08D);
  712.  
  713.  
  714. #if !GENERATINGCFM
  715. #pragma parameter __D0 EnterSupervisorMode
  716. #endif
  717. extern pascal StatusRegisterContents EnterSupervisorMode(void )
  718.  TWOWORDINLINE(0x7008, 0xA08D);
  719.  
  720. #endif
  721. /*
  722.  StripAddress and Translate24To32 macro to nothing on PowerPC
  723.    StripAddress is implemented as a trap in System 6 or later 
  724. */
  725. #if !GENERATINGPOWERPC
  726.  
  727. #if !GENERATINGCFM
  728. #pragma parameter __D0 StripAddress(__D0)
  729. #endif
  730. extern pascal Ptr StripAddress(void *theAddress)
  731.  ONEWORDINLINE(0xA055);
  732.  
  733. #else
  734. #define StripAddress(x)       ((Ptr)(x))
  735. #endif
  736. #if !GENERATINGPOWERPC
  737.  
  738. #if !GENERATINGCFM
  739. #pragma parameter __D0 Translate24To32(__D0)
  740. #endif
  741. extern pascal Ptr Translate24To32(void *addr24)
  742.  ONEWORDINLINE(0xA091);
  743.  
  744. #else
  745. #define Translate24To32(x)  ((Ptr)(x))
  746. #endif
  747. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  748. extern pascal OSErr HandToHand(Handle *theHndl);
  749.  
  750.  
  751. #if !GENERATINGCFM
  752. #pragma parameter __D0 PtrToXHand(__A0, __A1, __D0)
  753. #endif
  754. extern pascal OSErr PtrToXHand(const void *srcPtr, Handle dstHndl, long size)
  755.  ONEWORDINLINE(0xA9E2);
  756.  
  757. extern pascal OSErr PtrToHand(const void *srcPtr, Handle *dstHndl, long size);
  758.  
  759.  
  760. #if !GENERATINGCFM
  761. #pragma parameter __D0 HandAndHand(__A0, __A1)
  762. #endif
  763. extern pascal OSErr HandAndHand(Handle hand1, Handle hand2)
  764.  ONEWORDINLINE(0xA9E4);
  765.  
  766.  
  767. #if !GENERATINGCFM
  768. #pragma parameter __D0 PtrAndHand(__A0, __A1, __D0)
  769. #endif
  770. extern pascal OSErr PtrAndHand(const void *ptr1, Handle hand2, long size)
  771.  ONEWORDINLINE(0xA9EF);
  772.  
  773. #endif
  774. #if OLDROUTINENAMES
  775. #if FOR_SYSTEM7_ONLY
  776. #endif
  777. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  778. #define ApplicZone() ApplicationZone()
  779. #define MFTempNewHandle(logicalSize, resultCode) TempNewHandle(logicalSize, resultCode)
  780. #define MFMaxMem(grow) TempMaxMem(grow)
  781. #define MFFreeMem() TempFreeMem()
  782. #define MFTempHLock(h, resultCode) TempHLock(h, resultCode)
  783. #define MFTempHUnlock(h, resultCode) TempHUnlock(h, resultCode)
  784. #define MFTempDisposHandle(h, resultCode) TempDisposeHandle(h, resultCode)
  785. #define MFTopMem() TempTopMem()
  786. #define ResrvMem(cbNeeded) ReserveMem(cbNeeded)
  787. #define DisposPtr(p) DisposePtr(p)
  788. #define DisposHandle(h) DisposeHandle(h)
  789. #define ReallocHandle(h, byteCount) ReallocateHandle(h, byteCount)
  790. #endif
  791. #endif
  792.  
  793. #if PRAGMA_ALIGN_SUPPORTED
  794. #pragma options align=reset
  795. #endif
  796.  
  797. #if PRAGMA_IMPORT_SUPPORTED
  798. #pragma import off
  799. #endif
  800.  
  801. #ifdef __cplusplus
  802. }
  803. #endif
  804.  
  805. #endif /* __MEMORY__ */
  806.  
  807.